const mysql = require('mysql')

let data = [
    {
        "id": "00001",
        "article": "00001",
        "label": "公告",
        "title": "【更新PD客户端】傻瓜式秒提百度秒传",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_top/home_top_01.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00001.md",
        "classify": "top"
    },
    {
        "id": "00002",
        "article": "00002",
        "label": "Gal相关",
        "title": "关于百度秒传链接使用方法",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_top/home_top_02.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00002.md",
        "classify": "top"
    },
    {
        "id": "00003",
        "article": "00003",
        "label": "Gal相关",
        "title": "常见gal问题及解决办法",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_top/home_top_03.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00003.md",
        "classify": "top"
    },
    {
        "id": "00004",
        "article": "00004",
        "label": "GalGame",
        "title": "【自购】约会大作战 Twin Edition 凛绪轮回",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_top/home_top_04.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00004.md",
        "classify": "top"
    },
    {
        "id": "00005",
        "article": "00005",
        "label": "GalGame",
        "title": "Summer Pockets Reflection Blue",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_top/home_top_05.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00005.md",
        "classify": "top"
    },
    {
        "id": "00006",
        "article": "00006",
        "label": "GalGame",
        "title": "IdolDays",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_new/home_new_01.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00006.md",
        "classify": "new"
    },
    {
        "id": "00007",
        "article": "00007",
        "label": "GalGame",
        "title": "幽世ノ災厄ト現世ノ戦姫～きりえ篇～",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_new/home_new_02.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00007.md",
        "classify": "new"
    },
    {
        "id": "00008",
        "article": "00008",
        "label": "GalGame",
        "title": "缶詰少女ノ終末世界 〜アナザー＜八乙女華江編＞",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_new/home_new_03.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00008.md",
        "classify": "new"
    },
    {
        "id": "00009",
        "article": "00009",
        "label": "GalGame",
        "title": "悠久のカンパネラ",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_new/home_new_04.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00009.md",
        "classify": "new"
    },
    {
        "id": "00010",
        "article": "00010",
        "label": "GalGame",
        "title": "コイヤスミ 〜夕立に濡れた幼馴染み〜",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_new/home_new_05.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00010.md",
        "classify": "new"
    },
    {
        "id": "00011",
        "article": "00011",
        "label": "GalGame",
        "title": "【自购】PARQUET",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_new/home_new_06.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00011.md",
        "classify": "new"
    },
    {
        "id": "00012",
        "article": "00012",
        "label": "GalGame",
        "title": "D.C.4 Plus Harmony ～ダ・カーポ4～ プラスハーモニー",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_new/home_new_07.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00012.md",
        "classify": "new"
    },
    {
        "id": "00013",
        "article": "00013",
        "label": "GalGame",
        "title": "姫恋~縛羽の欠片~",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_new/home_new_08.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00013.md",
        "classify": "new"
    },
    {
        "id": "00014",
        "article": "00014",
        "label": "GalGame",
        "title": "YUKIHANA ART",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_acg/home_acg_01.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00014.md",
        "classify": "acg"
    },
    {
        "id": "00015",
        "article": "00015",
        "label": "GalGame",
        "title": "おとなの萌王 夏のドキドキ♥濡れ透け本",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_acg/home_acg_02.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00015.md",
        "classify": "acg"
    },
    {
        "id": "00016",
        "article": "00016",
        "label": "GalGame",
        "title": "電撃萌王 2021年4月号 [DL版]",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_acg/home_acg_03.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00016.md",
        "classify": "acg"
    },
    {
        "id": "00017",
        "article": "00017",
        "label": "GalGame",
        "title": "うりぼうざっか店 パンツ特化型画集 Under wears 4",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_acg/home_acg_04.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00017.md",
        "classify": "acg"
    },
    {
        "id": "00018",
        "article": "00018",
        "label": "GalGame",
        "title": "電撃萌王 2020月12号",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_acg/home_acg_05.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00018.md",
        "classify": "acg"
    },
    {
        "id": "00019",
        "article": "00019",
        "label": "GalGame",
        "title": "おとなの萌王　夏の妄想水着デート▼",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_acg/home_acg_06.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00019.md",
        "classify": "acg"
    },
    {
        "id": "00020",
        "article": "00020",
        "label": "GalGame",
        "title": "電撃萌王 2020年10月号",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_acg/home_acg_07.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00020.md",
        "classify": "acg"
    },
    {
        "id": "00021",
        "article": "00021",
        "label": "GalGame",
        "title": "mirage honey",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_acg/home_acg_08.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00021.md",
        "classify": "acg"
    },
    {
        "id": "00022",
        "article": "00022",
        "label": "GalGame",
        "title": "Spica5 (よろず)",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_acg/home_acg_09.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00022.md",
        "classify": "acg"
    },
    {
        "id": "00023",
        "article": "00023",
        "label": "GalGame",
        "title": "Bouquet23",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_acg/home_acg_10.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00023.md",
        "classify": "acg"
    },
    {
        "id": "00024",
        "article": "00024",
        "label": "GalGame",
        "title": "【自购】PARQUET",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_game/home_game_01.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00011.md",
        "classify": "game"
    },
    {
        "id": "00025",
        "article": "00025",
        "label": "GalGame",
        "title": "【生肉】LOOPERS",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_game/home_game_02.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00025.md",
        "classify": "game"
    },
    {
        "id": "00026",
        "article": "00026",
        "label": "GalGame",
        "title": "【自购】星空列车与白的旅行",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_game/home_game_03.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00026.md",
        "classify": "game"
    },
    {
        "id": "00027",
        "article": "00027",
        "label": "GalGame",
        "title": "夜访穿刺公",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_game/home_game_04.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00027.md",
        "classify": "game"
    },
    {
        "id": "00028",
        "article": "00028",
        "label": "GalGame",
        "title": "【自购】琉璃樱",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_game/home_game_05.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00028.md",
        "classify": "game"
    },
    {
        "id": "00029",
        "article": "00029",
        "label": "GalGame",
        "title": "D.C.4FD(本体+全特典）",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_game/home_game_06.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00029.md",
        "classify": "game"
    },
    {
        "id": "00030",
        "article": "00030",
        "label": "GalGame",
        "title": "Angel Beats！ -1st beat- V0.22",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_game/home_game_07.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00030.md",
        "classify": "game"
    },
    {
        "id": "00031",
        "article": "00031",
        "label": "GalGame",
        "title": "九段之都市传说",
        "author": "Sylvie233",
        "imgUrl": "http://localhost:8080/img/home_game/home_game_08.jpg",
        "like": 10,
        "comment": 8,
        "look": 11,
        "time": "2021-9-21",
        "article_path": "D:/work/galcg/galcg_pro/public/articles/article_00031.md",
        "classify": "game"
    },
]

let topicData = [
    {
        "id": "00001",
        "collection": "00001",
        "title": "Comiket 98",
        "imgUrl": "http://localhost:8080/img/home_top/home_top_01.jpg"
    },
    {
        "id": "00002",
        "collection": "00002",
        "title": "绘师画集",
        "imgUrl": "http://localhost:8080/img/home_top/home_top_02.jpg"
    },
    {
        "id": "00003",
        "collection": "00003",
        "title": "同人GAME",
        "imgUrl": "http://localhost:8080/img/home_top/home_top_03.jpg"
    },
    {
        "id": "00004",
        "collection": "00004",
        "title": "PC游戏",
        "imgUrl": "http://localhost:8080/img/home_top/home_top_04.jpg"
    }
]

// console.log(Object.values(data[0]))
var connection = mysql.createConnection({
  host: '49.232.9.254',
  port: 3306,      
  user: 'root',
  password: '17729014809@asdZXC',
  database: 'sylvie_galcg'
})
 
connection.connect((err) => {
    if (err) {
        console.log("连接失败")
        console.log(err)
    }
})

// data.forEach((item) => {
//     let sql = "insert into articles values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
//     connection.query(sql, Object.values(item), function (error, results, fields) {
//         if (error) {
//             console.log(error)
//         } else {
//             console.log(results)
//         }
//     })
// })

topicData.forEach((item) => {
    let sql = "insert into topics values(?, ?, ?, ?)"
    connection.query(sql, Object.values(item), function (error, results, fields) {
        if (error) {
            console.log(error)
        } else {
            console.log(results)
        }
    })
})
